namespace CSharpPro._0926;

public class Work
{
    public void TestPrint()
    {
       float originalPrice = 8800.0f;
       char continueCalc;
        
            do
            {
                Console.Write("请输入出行月份(1-12): ");
                int month = Convert.ToInt32(Console.ReadLine());
            
                Console.Write("请选择交通方式(F-航班, T-动车): ");
                char transport = Convert.ToChar(Console.ReadLine());
            
                bool isPeakSeason = (month >= 5 && month <= 10);
                bool isFlight = (transport == 'F' || transport == 'f');
            
                float discount;
            
                if (isPeakSeason && isFlight)
                {
                    discount = 0.9f;
                    Console.WriteLine("旺季航班出行，打9折");
                }
                else if (isPeakSeason && !isFlight)
                {
                    discount = 0.75f;
                    Console.WriteLine("旺季动车出行，打7.5折");
                }
                else if (!isPeakSeason && isFlight)
                {
                    discount = 0.6f;
                    Console.WriteLine("淡季航班出行，打6折");
                }
                else
                {
                    discount = 0.3f;
                    Console.WriteLine("淡季动车出行，打3折");
                }
            
                float finalPrice = originalPrice * discount;
            
                Console.WriteLine("原价: " + originalPrice + "元");
                Console.WriteLine("最终价格: " + finalPrice + "元");
            
                Console.Write("是否继续计算？(Y/N): ");
                continueCalc = Convert.ToChar(Console.ReadLine());
            
            } while (continueCalc == 'Y' || continueCalc == 'y'); 
            
    }

    public void TestPrint2()
    {
        

   
            char continueCheck;
        
            do
            {
                Console.Write("请输入年份: ");
                int year = Convert.ToInt32(Console.ReadLine());
            
                bool flag = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
            
                if (flag)
                {
                    Console.WriteLine(year + "年是闰年");
                }
                else
                {
                    Console.WriteLine(year + "年不是闰年");
                }
            
                Console.Write("是否继续判断？(Y/N): ");
                continueCheck = Convert.ToChar(Console.ReadLine());
            
            } while (continueCheck == 'Y' || continueCheck == 'y');
        
        
    
    }
}